home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
07
/
9
/
DISK0797.ZIP
/
KEYPRESS.DOC
< prev
next >
Wrap
Text File
|
1988-07-08
|
3KB
|
64 lines
KEYPRESS PC Magazine Vol 6 No 13, Jul 87 - P474 July 8, 1988
COMPLEMENTS
of
ABACUS Computer Service
Donald J. Jackowski
16 Green Road
Mine Hill, New Jersey 07801
INTRODUCTION
The KEYPRESS program provides the ability to branch in a
BATCH file. This program was published in the USER-TO-USER
column of PC Magazine July 21, 1987 Page 474.
FORMAT
KEYPRESS list of valid characters
REMARKS
The argument "list" is a list of one or more displayable
characters (optionally separated by one or more spaces), for
example,
KEYPRESS a b c d
invokes KEYPRESS which waits for the user to press a key, then
compares that key with the "list" of valid characters. If it's
in the "list", KEYPRESS returns a DOS exit code set to the index
of the character pressed in the "list" of valid characters; if it
is not, KEYPRESS returns an exit code of 0 (zero). So if the
batch file included the line in the example and the user typed a
C, KEYPRESS would report a 3, since "c" is the third character in
the "list". To allow greater flexibility KEYPRESS does not
distinguish between upper and lower case letters.
A sample batch file might look like this:
echo off
:query
echo Available Programs:
echo a. 123
echo b. dBASE
echo Your choice (a/b) ?
KEYPRESS a b
if errorlevel 2 goto b
if errorlevel 1 goto a
echo Invalid reply, try again.
goto query
:a
123
goto exit
:b
dBASE
:exit
NOTE: the exit codes returned by KEYPRESS must be checked from
highest to lowest (right to left in the "list" of valid
characters) because IF ERRORLEVEL "n" succeeds if the exit code
is greater than or equal to "n".
Author: Louis J. Cutrona, Jr. Page 1 of 1